package tests;

import java.io.File;

import application.*;

public class TestTool {

	public static void main(String[] args) throws Exception {

		String curDir = System.getProperty("user.dir") + "/data/" + "ETSF01-Data-Text.txt";
		File file = new File(curDir);

		Aesp tool = new Aesp(file);
		int k = 0;
		int count = 0;
		
			
		for (int i = 0; i < tool.size(); i++) {
			Project p = tool.get(i);
			tool.remove(p);
			tool.setThreshold(30);
			
			double effort = tool.estimateEffort(p, EstimationUnit.PERSON_DAYS);
			
			double acctual = p.getCharacteristicValue(p.getCharacteristic(tool.getSizeCharsNames()));
						
			double calc = effort/acctual;
			
			if((calc  < 0.7  || (calc < 1.3)) && effort != 0){
				count++;
			}
			tool.add(p);
		}
		
		System.out.println("Effort calculated with a maximum of 30% error from the acctual effort: " + (double)(count)/(double)((tool.size()-1))*100 + " %");

	}
}
